package com.design.clone;

import java.util.ArrayList;

/**
 * @ClassName Thing.java
 * @Description 
 * @author Jon
 * @date 2018年6月14日 下午8:56:34
 */
public class Thing implements Cloneable {
	private ArrayList<String> arrayList = new ArrayList<String>();
	
	@SuppressWarnings("unchecked")
	@Override
	protected Thing clone() throws CloneNotSupportedException {
		Thing thing = (Thing) super.clone();
		//将内部的集合也拷贝后才是深拷贝
		arrayList = (ArrayList<String>) arrayList.clone();
		return thing;
	}
	
	public void setValue(String value) {
		arrayList.add(value);
	}
	
	public ArrayList<String> getValue() {
		return arrayList;
	}
}
